import 'package:flutter/material.dart';

///加载失败widget
class LoadFailed extends StatelessWidget {
  final VoidCallback? doRetry;
  const LoadFailed({Key? key, this.doRetry}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            const Text("很遗憾 加载失败了"),
            MaterialButton(
              onPressed: () {
                print("执行重试");
                doRetry?.call();
              },
              child: const Padding(
                padding: EdgeInsets.all(8.0),
                child: Text("点击重试"),
              ),
            )
          ],
        ),
      ),
    );
  }
}
